package com.helloandroid.vo

import java.util.*


object ZouConstants {
    const val FreeCoin_1 = 1   // 小额
    const val FreeCoin_2 = 2   // 小额
    const val FreeCoin_3 = 3  // 大额
    const val FreeCoin_4 = 4 //  原红包外观
    val StepMap: TreeMap<Int, Int> = TreeMap(mapOf<Int, Int>(
            500 to 30,
            1500 to 45,
            3000 to 60,
            4500 to 80,
            6000 to 100,
            8000 to 100,
            10000 to 100,
            12000 to 100,
            14000 to 100,
            16000 to 100,
            18000 to 100,
            20000 to 100,
            22000 to 100,
            24000 to 100,
            26000 to 100,
            28000 to 100,
            30000 to 100
    ))

    /**
     * bsCount 为 -1 或者 为 StepMap 里面key的步数
     * 返回  bsCount 在 StepMap 里面的索引. 不存在则为 -1
     */
    fun getIdByBsCount(bsCount:Int):Int{
        if (bsCount < 1){
            return -1
        }
        val iter = StepMap.iterator()
        var id = -1
        while (iter.hasNext()){
            id++
            val item = iter.next()
            if (item.key == bsCount){
                return id
            }
        }
        return -1
    }

    fun getBSCount(awardId: Int):Int{
        val iter = StepMap.iterator()
        var id = -1
        while (iter.hasNext()){
            id++
            if(id == awardId){
                return iter.next().key
            }else{
                iter.next()
            }
        }
        return -1
    }
}